//
//  ClipImage.m
//  NumLot
//
//  Created by luotao on 12-8-17.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "ClipImage.h"


@implementation ClipImage


- (id)initWithFrame:(CGRect)frame {
    if ((self = [super initWithFrame:frame])) {
        // Initialization code
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

+(UIImage*)objectiveDrawRegion:(UIImage*) img sx:(int) sx1 sy:(int)sy1 sw:(int) sw1 sh:(int) sh1 desx:(int) desx1 desy:(int)desy1{
	//[self saveImage:img name:@"objectiveDrawRegion1.png"];
//	
//	//创建图片缓冲
//	void *imageDataRegion=malloc(screenWidth*screenHeight*32);
//	CGColorSpaceRef iColorSpaceRegion=CGColorSpaceCreateDeviceRGB();
//    CGContextRefiDeviceRegion=CGBitmapContextCreate(imageDataRegion,screenWidth,screenHeight,8,4*screenWidth,iColorSpaceRegion,kCGImageAlphaPremultipliedLast);
//	
//	
//	
//	//剪切区域
//    CGRect clipRegion=CGRectMake(sx1,sy1,sw1,sh1);
//    CGContextClipToRect(iDeviceRegion, clipRegion);
//    
//    CGFloat widthf=img.size.width;
//    CGFloat heightf=img.size.height;
//	
//	CGRect  cg=CGRectMake(0.0, 0.0, widthf, heightf);
//	//画底图
//    CGContextDrawImage(iDeviceRegion,cg, img.CGImage);
//	
//	//将缓冲形成图片
//    CGImageRef ioffRegion=CGBitmapContextCreateImage(iDeviceRegion);
//	
//	CGRect  cg1=CGRectMake(desx1, desy1, sw1, sh1);
//	UIImage *ui=[UIImage imageWithCGImage:ioffRegion];
//	
//	CGContextDrawImage(当前context,cg1, ui.CGImage);
//	
//	
//	//清除缓冲
//	CGColorSpaceRelease(iColorSpaceRegion);
//	CGContextRelease(iDeviceRegion);
//	CGImageRelease(ioffRegion);
//	free(imageDataRegion);
//	//    iDeviceRegion=NULL;
//	//    imageDataRegion=0;
//	
//	return ui;
	return nil;
}

- (void)dealloc {
    [super dealloc];
}


@end
